<body class="app bw" data-ad="true">

<section class="app-content">
	<section class="page page-index noline" data-plugin-type="info_front">

        <div class="top-bar">充值卡绑定<a href="<?php echo $this->url('my', array('action'=>'home'));?>" class="btn-t-back"></a></div>

        <form class="code-form">
            <p>请输入鸿益储值卡密码：</p>
            <p><input id="secret_code" type="text"></p>
            <p class="txt-c"><a href="<?php echo $this->url('my', array('action'=>'balance'));?>" class="btn-yel">查询余额</a>
            <a href="javascript:;" onclick="rechargeSubmit()" class="btn-yel">绑 定</a></p>

        </form>
	</section>

    <!-- 底部menu-->
    <?php echo $this->partial('public/menu.phtml'); ?>
</section>

<script type="text/javascript">

var isPost = false

function rechargeSubmit(){

 	if(isPost == false) {
	 	isPost = true;
    	$.ajax({
             type: "post",
             url : "<?php echo $this->url('my',
                 array('action'=>'ajax-recharge-submit'));?>",
             dataType:'json',
             data:  { "secret_code": $("#secret_code").val()},
             cache: false,
             timeout:10000, 
             error: function(){
               	  alert('请求超时，请重新操作');
                  isPost = false;
                  return false; 
             }, 
             success: function(data){
                  if(data.result == true) {
					  alert('充值成功');
					  window.location.reload();
                  } else {
                	  alert(data.msg);
                  }
             	  isPost = false;
             }
     	});
 	}
}

function closeOrderDetail(){
	$("#order_detail").html("");
}

</script>